
use global_BLAs_09_21_21, clear

merge 1:1 ID using bla_coding_first_09_27_21.dta

keep if _merge==3

/*Confirming the data are correct

gen data_correct = 1 if (countryA==coded_countryA & countryB==coded_countryB | countryA==coded_countryB & countryB==coded_countryA) & year==coded_year
replace data_correct = 0 if data_correct==. & _merge==3

browse ID countryA countryB year coded_countryA coded_countryB coded_year agreement_title ///
	if data_correct==0

*/

gen governance_title  = 0, b(intl_instr)
lab var governance_title "{bf:Governance of Labor Migration}"

gen protection_title = 0, b(migrant_info)
lab var protection_title "{bf:Protection and Empowerment of Migrant Workers}"
gen protection_space = 0, b(protection_title)
lab var protection_space " "

gen dev_title = 0, b(mig_human_cap)
lab var dev_title "{bf:Migration and Development}"
gen dev_space = 0, b(dev_title)
lab var dev_space " "

vl create barvars = (governance_title-recruit_auth labor_union_orig-perm_resid)

vl create barvars1 = (intl_instr-recruit_auth labor_union_orig-ngos)
vl create barvars2 = (migrant_info-disputes_emp_mig)
vl create barvars3 = (mig_human_cap-perm_resid)



*9) graph of prevalence of provisions

global barvarlabs ""
local i = 1
foreach var in $barvars {
    
	global barvarlabs `"$barvarlabs `i' "`:var lab `var''""'
	local `i++'
	
}

*a) all provisions
#delimit;

graph hbar $barvars , ascat yvar(relabel($barvarlabs ) label(labsize(*0.5))) 
	bar(1, color(gs11)) graphregion(color(white)) ylab(0(0.1)0.7) name(provisions_bargraph_all, replace);

#delimit cr
